package com.forn6.n6_bt_ringbell;
import android.annotation.SuppressLint;
import android.content.Context;
import android.database.sqlite.*;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import com.forn6.n6_bt_ringbell.NumDBSchema;


public class NumDB extends SQLiteOpenHelper {
	
	public NumDB(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}
	
	public static final int DATABASE_VERSION = 1;
    public static final String DATABASE_NAME = "numDB.db";

    public NumDB(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(NumDBSchema.SQL_CREATE_ENTRIES);
    }
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // This database is only a cache for online data, so its upgrade policy is
        // to simply to discard the data and start over
        db.execSQL(NumDBSchema.SQL_DELETE_ENTRIES);
        onCreate(db);
    }
    @SuppressLint("Override") public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        onUpgrade(db, oldVersion, newVersion);
    }
}
